/*
 * chomp.c - Removes any trailing new line
 */

int
chomp(char *str)
{
  char *s;
  if (*str == '\0')
    return 0;
  for (s=str; *s != '\0'; s++)
    ;
  if (*(s-1) == '\n') {
    *(s-1) = '\0';
    return 1;
  }
  return 0;
}

int
chomp2(char *str, char sep)
{
  char *s;
  if (*str == '\0')
    return 0;
  for (s=str; *s != '\0'; s++)
    ;
  if (*(s-1) == sep) {
    *(s-1) == '\0';
    return 1;
  }
  return 0;
}
